fix(create-blocks-app): include Amplify dev server template#242
Conversation
🦋 Changeset detectedLatest commit: d0bb476 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
There was a problem hiding this comment.
Thanks for this — the added server.ts correctly resolves the npm run blocks:dev / ERR_MODULE_NOT_FOUND failure, and the regression test is a nice touch.
One thing to flag before this closes #241: the issue reports two separate failures, and this PR only addresses the first. The second — npm run blocks:generate-client failing with Cannot find package '@aws-blocks/core' — is still present, because the Amplify template imports @aws-blocks/core directly even though only @aws-blocks/blocks is declared as a dependency.
The cleanest fix is to import through the public @aws-blocks/blocks package instead of the internal @aws-blocks/core, in both files:
aws-blocks/scripts/generate-client.ts→import { generateClientCode } from '@aws-blocks/blocks/scripts'aws-blocks/cognito-verifier.ts→import { ApiError, type BlocksContext } from '@aws-blocks/blocks'
(Note it needs both — fixing only generate-client.ts will just surface the same error from cognito-verifier.ts next.) Since Fixes #241 would auto-close the issue, could we either fold this in here, or switch to Partially addresses #241 and track it separately?
There was a problem hiding this comment.
Thanks for this — the added server.ts correctly resolves the npm run blocks:dev / ERR_MODULE_NOT_FOUND failure, and the regression test is a nice touch.
One thing to flag before this closes #241: the issue reports two separate failures, and this PR only addresses the first. The second — npm run blocks:generate-client failing with Cannot find package '@aws-blocks/core' — is still present, because the Amplify template imports @aws-blocks/core directly even though only @aws-blocks/blocks is declared as a dependency.
The cleanest fix is to import through the public @aws-blocks/blocks package instead of the internal @aws-blocks/core, in both files:
aws-blocks/scripts/generate-client.ts→import { generateClientCode } from '@aws-blocks/blocks/scripts'aws-blocks/cognito-verifier.ts→import { ApiError, type BlocksContext } from '@aws-blocks/blocks'
(Note it needs both — fixing only generate-client.ts will just surface the same error from cognito-verifier.ts next.) Since Fixes #241 would auto-close the issue, could we either fold this in here, or switch to Partially addresses #241 and track it separately?
Problem
Issue #, if available: Fixes #241
When AWS Blocks is added to an Amplify Gen 2 project, the CLI adds
blocks:devwithtsx watch aws-blocks/scripts/server.ts. The Amplify overlay did not include that file, so the documented command immediately failed withERR_MODULE_NOT_FOUND.This is present in the published
@aws-blocks/create-blocks-apppackage as well as in the repository source.Changes
aws-blocks/scripts/server.tstemplate, using the existing backend-template local server pattern on port 3001.blocks:devscript has a matching server file.@aws-blocks/create-blocks-app.Validation
npm run buildnpm run lint:depsnpm testnpm run test:e2e:local(comprehensive: 372 passed, 0 failed, 1 skipped; vendorize: 8 passed, 0 failed)npm pack --dry-run --workspace @aws-blocks/create-blocks-appconfirms the new template is included.npx changeset statusChecklist
blocks:devcommand; it adds no new user-facing workflow or API documentation.)By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.